package com.bpzj.util.pdf;

import com.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfWriter;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import static com.bpzj.util.pdf.DIDITravelTripOld.fixPositionText;

public class Zuheziti {
    public static void main(String[] args) {
        Document document = new Document(PageSize.A4, 0, 0, 0, 0);
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("组合字.pdf"));
            document.open();
            String fontPath = "C:\\Users\\Administrator\\Desktop\\msyh.ttf";
//             fontPath = "C:\\Users\\Administrator\\Desktop\\simsunb.ttf";
            BaseFont yahei = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);

            Font font = new Font(yahei, 8.5f, Font.UNDEFINED, BaseColor.BLACK);

            font = new Font(yahei, 7f, Font.UNDEFINED, BaseColor.BLACK);
            fixPositionText(writer, "你", yahei, 10, 10, 200);
            fixPositionText(writer, "好", yahei, 10, 200, 190);
//            PdfContentByte directContent = writer.getDirectContent();
//            VerticalText text = new VerticalText(directContent);
//            text.addText(new Paragraph("你好世界"));
//            text.go();


            // 页码

            //            document.add(table);
            //            document.add(paragraph);
        } catch (DocumentException | FileNotFoundException de) {
            System.err.println(de.getMessage());
        } catch (IOException  e) {
            e.printStackTrace();
        }
        document.close();
    }
}
